
package com.yuanduo_app.bridge;

import com.beefe.picker.PickerViewModule;
import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager;

import com.yuanduo_app.manager.RNModuleManager;
import com.yuanduo_app.signaturecapture.RSSignatureCaptureViewManager;
import com.yuanduo_app.widget.MapViewManager;
import com.yuanduo_app.widget.QRCodeViewManager;
import com.yuanduo_app.widget.VRPlayerViewManager;
import com.yuanduo_app.widget.WaterCameraViewManager;
import com.yuanduo_app.widget.record.RecordRnView;
import com.yuanduo_app.widget.record.VideoRnView;


import java.util.ArrayList;
import java.util.List;

public class RNReactPackage implements ReactPackage {
    private List<NativeModule> modules = new ArrayList<>();
    private List<ViewManager> views = new ArrayList<>();

    @Override
    public List<ViewManager> createViewManagers (ReactApplicationContext reactContext) {
        views.clear();
        views.add(new MapViewManager());
        views.add(new RecordRnView());
        views.add(new VideoRnView());
        views.add(new QRCodeViewManager());
        views.add(new VRPlayerViewManager());
        views.add(new WaterCameraViewManager());

        views.add(new RSSignatureCaptureViewManager(reactContext));

        return views;
    }

    @Override
    public List<NativeModule> createNativeModules (
            ReactApplicationContext reactContext) {
        modules.clear();
//        添加一个安卓原生的activity模块
        modules.add(new RNBridgeModule(reactContext));
        //人脸识别
        modules.add(new BaiduFaceModule(reactContext));
        //地图
        modules.add(new MapModule(reactContext));
        //弹窗
        modules.add(new WindowModule(reactContext));
        //数据相关
        modules.add(new DataModule(reactContext));
        //支付
        modules.add(new PayModule(reactContext));
        //选择器
        modules.add(new PickerViewModule(reactContext));
        //录音
        modules.add(new AudioRecorderManager(reactContext));
        //播放声音
        modules.add(new RNSoundModule(reactContext));
        //二维码识别
        modules.add(new QrCodeModule(reactContext));
        RNModuleManager.getInstance().initAdd(modules);
        return modules;
    }


    public List<NativeModule> getModules () {
        return modules;
    }
}
